local leicheng = fk.CreateSkill {
  name = "lingling__leicheng",
}

Fk:loadTranslationTable {
  ["lingling__leicheng"] = "垒城",
  [":lingling__leicheng"] = "出牌阶段，你可以弃置一张红色基本牌，令一名角色加1点护甲，若为【桃】，你回复1点体力。",

  ["#lingling__leicheng"] = "垒城：弃一张红色基本牌，令一名角色加1点护甲",
}

leicheng:addEffect("active", {
  anim_type = "offensive",
  prompt = "#lingling__leicheng",
  card_num = 1,
  target_num = 1,
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and not player:prohibitDiscard(to_select) and
        Fk:getCardById(to_select).type == Card.TypeBasic and Fk:getCardById(to_select).color == Card.Red
  end,
  target_filter = function(self, player, to_select, selected, selected_cards)
    return #selected == 0
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    room:throwCard(effect.cards, leicheng.name, player, player)
    if target.dead then return end
    room:changeShield(target, 1)
    if Fk:getCardById(effect.cards[1]).trueName == "peach" and not player.dead and player:isWounded() then
      room:recover{
        who = player,
        recoverBy = player,
        num = 1,
        skillName = leicheng.name,
      }
    end
  end,
})

return leicheng
